﻿@model IEnumerable<Student>
@{
    
    ViewBag.Title = "学生列表页面";
}

@*<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>学生页面列表</title>
</head>
<body>*@

@*<table>
    <thead>
    <tr>
        <th>ID</th>
        <th>名字</th>
        <th>邮箱</th>
        <th>班级名称</th>
    </tr>
    </thead>
    <tbody>
        @foreach (var student in Model)
        {
        <tr>
            <td>
                @student.Id
            </td>
            <td>
                @student.Name
            </td>
            <td>
                @student.Email
            </td>
            <td>
                @student.ClassName
            </td>
        </tr>
        }
    </tbody>
</table>*@

<div class="card-deck">
    @foreach (var student in Model)
    {
        var photoPath = $"~/images/{student.PhotoPath??"tiger.jpg"}";
    <div class="card m-3">
        <div class="card-header">
            <h3>@student.Name</h3>
        </div>
        <img class="card-img-top imagesThumbnail" src="@photoPath" asp-append-version="true"/>
        <div class="card-footer text-center">
            <a asp-controller="Home" asp-action="Details" asp-route-id="@student.Id" class="btn btn-primary m-1">查看</a>

            @*@Html.ActionLink("查看", "Details", "Home", new {id = student.Id})*@
            <a href="@Url.Action("Details", "Home", new {id = student.Id})" class="btn btn-primary m-1">查看</a>
            <a href="/home/details/@student.Id" class="btn btn-primary m-1">查看</a>
            <a asp-controller="Home" asp-action="edit" asp-route-id="@student.Id" class="btn btn-primary m-1">编辑</a>
            <a href="#" class="btn btn-danger m-1">删除</a>
        </div>
    </div>
    }
</div>

@*</body>
</html>*@